package com.c.opt;

import cn.hutool.db.Entity;
import cn.hutool.db.PageResult;
import cn.hutool.db.sql.Direction;
import com.c.opt.query.ComOptQueryWrapper;
import com.c.opt.query.ComQueryInfo;

import java.util.List;

public class ComChainOpt<T> extends ComOptQueryWrapper {

    private ComOptInterface<T> comOptInterface;

    public ComChainOpt(ComOptInterface<T> comOptInterface) {
        super(comOptInterface.tName());
        this.comOptInterface = comOptInterface;
    }

    public List<Entity> list() {
        return comOptInterface.list(this);
    }

    public List<T> listBean() {
        return comOptInterface.listBean(this);
    }

    public Entity get() {
        return comOptInterface.get(this);
    }

    public T getBean() {
        return comOptInterface.getBean(this);
    }

    public PageResult<Entity> page(Integer page, Integer size) {
        return comOptInterface.page(this, page, size);
    }

    public PageResult<T> pageBean(Integer page, Integer size) {
        return comOptInterface.pageBean(this, page, size);
    }

    @Override
    public ComChainOpt<T> logicDelFlag() {
        super.logicDelFlag();
        return this;
    }

    @Override
    public ComChainOpt<T> desc(String name) {
        super.desc(name);
        return this;
    }

    @Override
    public ComChainOpt<T> asc(String name) {
        super.asc(name);
        return this;
    }

    @Override
    public ComChainOpt<T> order(String name, Direction asc) {
        super.order(name, asc);
        return this;
    }

    @Override
    public ComChainOpt<T> build(ComQueryInfo comQueryInfo) {
        super.build(comQueryInfo);
        return this;
    }

    @Override
    public ComChainOpt<T> eq(String key, String val) {
        super.eq(key, val);
        return this;
    }

    @Override
    public ComChainOpt<T> orEq(String key, String val) {
        super.orEq(key, val);
        return this;
    }

    @Override
    public ComChainOpt<T> ne(String key, String val) {
        super.ne(key, val);
        return this;
    }

    @Override
    public ComChainOpt<T> like(String key, String val) {
        super.like(key, val);
        return this;
    }

    @Override
    public ComChainOpt<T> orLike(String key, String val) {
        super.orLike(key, val);
        return this;
    }

    @Override
    public ComChainOpt<T> ge(String key, String val) {
        super.ge(key, val);
        return this;
    }

    @Override
    public ComChainOpt<T> le(String key, String val) {
        super.le(key, val);
        return this;
    }

    @Override
    public ComChainOpt<T> in(String key, List<String> values) {
        super.in(key, values);
        return this;
    }

    @Override
    public ComChainOpt<T> isNull(String key) {
        super.isNull(key);
        return this;
    }

    @Override
    public ComChainOpt<T> isNotNull(String key) {
        super.isNotNull(key);
        return this;
    }

}
